package com.qf.bookshop2.service.impl;

import com.qf.bookshop2.mapper.RoleMapper;
import com.qf.bookshop2.model.Role;
import com.qf.bookshop2.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
@Service
public class RoleServiceImpl implements RoleService {
    @Autowired
    RoleMapper mapper;

    @Override
    public List<String> getRolesByUsername(String username) {
        List<Role> roles = mapper.selectRolesByUserName(username);
        List<String> list=new ArrayList<>();
        for(Role r:roles){
            list.add(r.getRoleName());
        }
        return list;
    }
}
